package jianzhi

import (
	"sort"
	"strconv"
)

func minNumber(nums []int) string {
	sort.Slice(nums, func(i, j int) bool {

		str1 := strconv.Itoa(nums[i]) + strconv.Itoa(nums[j])
		str2 := strconv.Itoa(nums[j]) + strconv.Itoa(nums[i])

		num1, _ := strconv.Atoi(str1)
		num2, _ := strconv.Atoi(str2)

		return num1 < num2
	})

	res := ""
	for _, v := range nums {
		res += strconv.Itoa(v)
	}

	return res

}
